package com.school.gift.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.school.gift.domain.Feedback;
import com.school.gift.mapper.FeedbackMapper;
import com.school.gift.model.FeedBackModel;
import com.school.gift.service.FeedbackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import zhibi.common.support.base.Page;
import zhibi.common.support.base.service.BaseServiceImpl;
import zhibi.common.support.mybatis.example.Example;

/**
 * Created by 执笔 on 2017/3/23.
 */
@Service
@Transactional
public class FeedBackServiceImpl extends BaseServiceImpl<Feedback> implements FeedbackService {

    @Autowired
    public FeedBackServiceImpl(FeedbackMapper mapper) {
        super(mapper);
        this.feedbackMapper = mapper;
    }

    private FeedbackMapper feedbackMapper;

    @Override
    public PageInfo<FeedBackModel> selectModel(Example example, Page page) {
        if(page != null) PageHelper.startPage(page.getPageNum(),page.getPageSize());
        return new PageInfo<>(feedbackMapper.selectModel(example),Page.NAV_SIZE);
    }
}
